package com.ruoyi.project.system.commodity.controller.utils;

import org.apache.poi.ss.formula.functions.T;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PageMsg {

    public static Map<String,Object> getMsgMap(int count, int end, int page,int pageSize){
        Map<String,Object> map = new HashMap<>();
        int totalPage = (int) Math.ceil((double)count / pageSize);
        map.put("code", 200);
        map.put("msg","success");
        map.put("total_Page",totalPage);
        map.put("next", IsNext.hasNext(count,end));
        map.put("current_page",page);
        map.put("next_page",IsNext.hasNext(count, end) ? page + 1:false);
        map.put("previous_page",page == 0 ? false:page - 1);
        return  map;
    }
}
